package com.goods.shop.exam;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class BankModel{
    private BigDecimal loanMoney;//贷款金额
    private BigDecimal loanRate;//贷款利率
    private BigDecimal extendRate;//展期利率
    private BigDecimal overdueRate;//逾期利率
    private int normalDays;//正常计息时间段
    private int extendDays;//展期时间段
    private int[] days;//后续的各个日期时间段

    public BigDecimal getLoanMoney() {
        return loanMoney;
    }

    public void setLoanMoney(BigDecimal loanMoney) {
        this.loanMoney = loanMoney;
    }

    public BigDecimal getLoanRate() {
        return loanRate;
    }

    public void setLoanRate(BigDecimal loanRate) {
        this.loanRate = loanRate;
    }

    public BigDecimal getExtendRate() {
        return extendRate;
    }

    public void setExtendRate(BigDecimal extendRate) {
        this.extendRate = extendRate;
    }

    public BigDecimal getOverdueRate() {
        return overdueRate;
    }

    public void setOverdueRate(BigDecimal overdueRate) {
        this.overdueRate = overdueRate;
    }

    public int getNormalDays() {
        return normalDays;
    }

    public void setNormalDays(int normalDays) {
        this.normalDays = normalDays;
    }

    public int getExtendDays() {
        return extendDays;
    }

    public void setExtendDays(int extendDays) {
        this.extendDays = extendDays;
    }

    public int[] getDays() {
        return days;
    }

    public void setDays(int[] days) {
        this.days = days;
    }
}
public class BankRates {
    public BigDecimal calculation(BankModel bank,int day){
        BigDecimal totalMoney=bank.getLoanMoney();
        BigDecimal dayMoney=new BigDecimal("0.00");
        if(day<bank.getNormalDays()){
            dayMoney=totalMoney.multiply(bank.getLoanRate()).multiply(new BigDecimal(day)).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
        }else if(day<bank.getExtendDays()){
            dayMoney=totalMoney.multiply(bank.getLoanRate()).multiply(new BigDecimal(bank.getNormalDays())).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
            dayMoney=dayMoney.add(totalMoney.multiply(bank.getExtendRate()).multiply(new BigDecimal(day-bank.getNormalDays())).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP));
            return dayMoney;
        }else{
            dayMoney=totalMoney.multiply(bank.getLoanRate()).multiply(new BigDecimal(bank.getNormalDays())).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
            BigDecimal extendsMoney=totalMoney.multiply(bank.getExtendRate()).multiply(new BigDecimal(bank.getExtendDays()-bank.getNormalDays())).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
            dayMoney=dayMoney.add(extendsMoney);
            BigDecimal overDueMoney=totalMoney.multiply(bank.getOverdueRate()).multiply(new BigDecimal(day-bank.getExtendDays())).divide(new BigDecimal("360"),2,BigDecimal.ROUND_HALF_UP);
            dayMoney=dayMoney.add(overDueMoney);
        }
        return dayMoney;
    }
    public static void main(String[] args) {
        BankModel bankParam=new BankModel();
        BankRates rateService=new BankRates();
        Scanner scanner=new Scanner(System.in);
        String line=scanner.nextLine();
        String[] datas=line.split(" ");
        if(datas.length!=6)return;
        bankParam.setLoanMoney(new BigDecimal(datas[0]));
        bankParam.setLoanRate(new BigDecimal(datas[1]));
        bankParam.setExtendRate(new BigDecimal(datas[2]));
        bankParam.setOverdueRate(new BigDecimal(datas[3]));
        bankParam.setNormalDays(Integer.valueOf(datas[4]));
        bankParam.setExtendDays(Integer.valueOf(datas[5]));

        BigDecimal totalMoney=bankParam.getLoanMoney();
        List<Integer> days= new ArrayList<>();
        int data=scanner.nextInt();
        while(data!=-1){
            days.add(data);
            data=scanner.nextInt();
        }
        DecimalFormat format=new DecimalFormat();
        format.applyPattern("0.00");
        for(Integer day:days){
            BigDecimal dayMoney=rateService.calculation(bankParam,day);
            System.out.println(format.format(dayMoney));
        }
    }

}
